<?php
// +----------------------------------------------------------------------
// | ZGUAN [ 致力于帮助更多的中小企业实现低成本数字化转型 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.zguan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ZGUAN 并不是自由软件，未经许可不能去掉ZGUAN 相关版权
// +----------------------------------------------------------------------
// | Author: ZGUAN Team <admin@zguan.cn>  0769-82282996  15899929162
// +----------------------------------------------------------------------
namespace app\validate\bill;

use think\Validate;

class BillBasicValidate extends Validate
{
    protected $rule = [
        'number|账单编号' => 'require',
        'is_type|账单类型' => 'require|in:1,2',
        'room_id|房间信息' => 'number',
        'cutoff_date|支付时间' => 'require',
        'overdue_fine_fee|滞纳金比例' => 'require',
        'other_fee|账单明细' => 'require',
    ];

    public function sceneAdd()
    {
        return $this->remove('id', 'require');
    }

    public function sceneEdit()
    {
        return $this->remove('id', 'require')
            ->remove('room_id', 'require')
            ->remove('is_type', 'require')
            ->remove('other_fee', 'require')
            ->remove('cutoff_date', 'require')
            ->remove('overdue_fine_fee', 'require')
            ->remove('number', 'require');
    }

    public function sceneDel()
    {
        return $this->only(['id'])->append('id', 'require|number');
    }


    /**
     * 添加物业支出账单
     * @return BillBasicValidate
     *
     * @author Amos
     * 2024-05-04 16:40
     */
    public function scenEexpendAdd()
    {
        return $this->only(['property_id'])
            ->append('property_id|物业信息', 'require|number');
    }

    /**
     * 账单支付
     * @return BillBasicValidate
     *
     * @author Amos
     * 2024-05-15 23:26
     */
    public function scenePayment()
    {
        return $this->only(['pay_method', 'pay_amount'])
            ->append('pay_method|支付方式', 'require|in:1,2,3,4,5')
            ->append('pay_amount|支付金额', 'require|float');
    }
}